#include "Comment.hpp"

int main()
{
	cout<<"后端启动成功\n";
	//先创建关键值
	int key = ftok(gpathname.c_str(), gproj_id);
	//创建共享内存
	int shmid= shmget(key,gdefaultsize,IPC_CREAT|IPC_EXCL|0666); // 创建全新的shm
	if(shmid<0)
	{
		perror("创建失败\n");
		return -1;
	}
	//添加至地址space
	char* addr = (char*)shmat(shmid, nullptr, 0);
	int m=0;
    while(m<=10)
    {
        cout<<addr<<endl;
        sleep(1);
		m++;
    }

	shmctl(shmid,IPC_RMID,nullptr);
	cout<<"share memmory delete sucess!\n";
	return 0;
}